package fragments;

import by.bucha.tabnavigationproject.tabsframework.AbstractTabActivity;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListFragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class FirstListFragment extends SherlockListFragment {

	public FirstListFragment() {
	}

	public AbstractTabActivity getTabStack() {
		return (AbstractTabActivity) getActivity();
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
				"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
				"Linux", "OS/2" };
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
				android.R.layout.simple_list_item_1, values);
		setListAdapter(adapter);

		ActionBar ab = getSherlockActivity().getSupportActionBar();
		ab.setTitle("First tab,first fragment");
	}

	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);

		Fragment newFragment = new FirstList2Fragment();

		getTabStack().pushFragment(newFragment);

	}
}
